/**
  ETFDAQ Project
  \class TAmTDC32
  \brief a 32 ECL ch TDC Mesytec card with 4ps resolution
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2024-09-05
  \date 2024-09-05 last modified

  \copyright Copyright (c) 2024 IMP-CAS with LGPLv3 LICENSE
*/

#ifndef TAmTDC32_h
#define TAmTDC32_h

#include "TAMesytec.h"

class TAmTDC32 : public TAMesytec{
public:
  TAmTDC32(TAController *ctrl, const TAYaml &c);
  virtual ~TAmTDC32();

  ///--- initialization ---///
  virtual void Initialize() override; ///< config the card

  /// \param bank: 0 or 1
  // 0x0 ~ 0xff, in step of 1.5V/256, only for uniporlar signal: NIM, TTL
  // optmum: nim->105 (default); TTL->255
  virtual void SetThreshold(int bank, uint16_t thre) const override;
  /// \param opt0(1); whether using trailing edge for timing or not for bank0(1)
  virtual void UseFallingEdge(bool opt0, bool opt1);
  virtual void Print() const override; ///< print config info
  virtual void PrintEvent(const uint32_t *ev)  override; ///< print one event

  virtual void SetResolution(uint16_t res) override;

  static const double kRes[10]; ///< resolutions, in ns
  static const double kThreStep; ///< in mV
};

#endif
